<%@ page language="java" contentType="text/html; charset=UTF-8"	 pageEncoding="UTF-8"%>
<%@include file="/common/taglibs.jsp"%>
<!DOCTYPE html>
<html lang="en">
<head>	
	<jsp:include page="/common/form_head.jsp"></jsp:include>	
	<%@include file="/common/include-bootstrap.jsp"%>
	<title>招聘申请</title>		
	
</head>
<body>
<section class="main-content">
	<div class="content-wrap">
		<section class="panel panel-default">
			<div class="panel-heading">
				<b>招聘申请</b>
				<small class="pull-right">
					<a href="javascript:javascript:history.go(-1);" class="pd-r-xs"><i class="fa fa-reply"></i> 返回</a>
					<a href="javascript:window.location.reload();" class="pd-r-xs"><i class="fa fa-refresh"></i> 刷新</a>
				</small>
			</div>
			<div class="panel-body">
				<form class="form-horizontal" action="${ctx}/oa/position/save" method="post" id="form">
					<div class="form-group">
						<label class="col-sm-4 control-label">职位标题:</label>
						<div class="col-sm-4 col-md-6">
							<input type="text" name="title" value="${position.title}" placeholder="工程师" class="form-control input-sm">
							<input type="hidden" name="id" value="${position.id}">
						</div>
					</div>
					<div class="form-group">
						<label class="col-sm-4 control-label">职能类型:</label>
						<div class="col-sm-4 col-md-6 ">
							<select class="form-control input-sm" name="depName" value="${position.depName}" >
								<option value="技术">研发与技术</option>
								<option value="产品">产品与设计</option>								
								<option value="生产">生产与工程</option>								
								<option value="市场">市场与运营</option>
								<option value="物流">物流与客服</option>	
								<option value="管理">管理</option>
								<option value="职能">职能与服务</option>
							</select>
						</div>
					</div>
					
					<div class="form-group">
		                <label class="col-sm-4 control-label">组织机构:</label>
		                <div class="col-sm-4">
		                    <select class="form-control input-sm" name="depId">
		                        <option value="" <c:if test="${position.depId==null}">selected</c:if> >请选择</option>
		                        <c:forEach var="r" items="${organizations}" varStatus="s">
		                            <option value="${r.id}"
		                                    <c:if test="${position.depId==r.id}">selected</c:if> >${r.name}</option>
		                        </c:forEach>
		                    </select>
		                </div>
		             </div>
					
					<div class="form-group">
						<label class="col-sm-4 control-label">职位描述:</label>
						<div class="col-sm-4 col-md-6">
							<textarea name="jobDescription" placeholder="职位职责" rows="5" class="form-control">${position.jobDescription}
							</textarea>
						</div>
					</div>
					<div class="form-group">
						<label class="col-sm-4 control-label">职位要求:</label>
						<div class="col-sm-4 col-md-6">
							<textarea name="jobRequirement" placeholder="职位要求" rows="5" class="form-control">${position.jobRequirement}
							</textarea>
						</div>
					</div>
					
					<div class="form-group">
						<label class="col-sm-4 control-label">学历要求:</label>
						<!-- 
简历:
1|本科  
3|硕士
4|博士
5|博士后
6|MBA
7|中专
8|大专
9|大专以下
10|高中
2|MBA
0|未知
职位:
学历要求 0:不限 1：大专及以上 2：本科及以上 3：硕士及以上 4：博士及以上
						
						 -->
						<div class="col-sm-4 col-md-6 ">
							<select class="form-control input-sm" name="degree_required" value="${position.degree_required}">
								<option value="0">不限</option>
								<option value="1">大专及以上</option>
								<option value="2">本科及以上</option>
								<option value="3">硕士及以上</option>
								<option value="4">博士及以上</option>
							</select>
						</div>
					</div>
					
					<div class="form-group">
						<label class="col-sm-4 control-label">薪资范围(年薪):</label>
						<div class="col-sm-2 col-md-3">
							<input type="number" name="min_show_annual_salary" placeholder="从" class="form-control input-sm" value="${position.min_show_annual_salary}" >
						</div>
						<div class="col-sm-2 col-md-3">
							<input type="number" name="max_show_annual_salary"  placeholder="到" class="form-control input-sm" value="${position.max_show_annual_salary}" >
						</div>		
					</div>
					<div class="form-group">
						<label class="col-sm-4 control-label">薪资说明:</label>
						<div class="col-sm-4 col-md-6">
							<textarea name="salaryDescription" placeholder="薪资说明" rows="2" class="form-control">${position.salaryDescription}
							</textarea>
						</div>
					</div>
					<div class="form-group">
						<label class="col-sm-4 control-label">招聘开始时间:</label>
						<div class="col-sm-2 col-md-3">
							<input type="text" name="startTime" placeholder="招聘启动日期"  value='<fmt:formatDate value="${position.startTime}" type="date"/>' class="form-control date input-sm">
						</div>
						<div class="col-sm-2 col-md-3">
							<input type="text" name="endTime"  placeholder="截止日期"  value='<fmt:formatDate value="${position.endTime}" type="date"/>' class="form-control date input-sm">
						</div>						
					</div>
					<div class="form-group">
						<label class="col-sm-4 control-label">招聘数目:</label>
						<div class="col-sm-4 col-md-6 ">
							<input type="number" name="headCount"  placeholder="数量" value="${position.headCount}" class="form-control input-sm">
						</div>
					</div>
					
					<div class="form-group">
						<div class="col-sm-offset-4 col-sm-4 col-md-6">
							<button type="button" class="btn btn-primary btn-sm btn-block" onclick="submitPosition();">保存并提交</button>
						</div>
					</div>
				</form>
			</div>
		</section>
	</div>
</section>
<script type="text/javascript">
	function submitPosition(){
		var startTimeC = checkEmpty($('[name="startTime"]'),'请选择开始时间');
		var endTimeC = checkEmpty($('[name="endTime"]'),'请选择结束时间');
		var titleC = checkEmpty($('[name="title"]'),'请填写职位标题');
		var reasonC = checkEmpty($('[name="jobRequirement"]'),'请填写职位要求');
		if(startTimeC && endTimeC && reasonC && titleC){
			msg.confirm("确认保存？",function(){
				$.ajax({
					type : "POST",
					data : $("#form").serialize(),
					url : $("#form").attr("action"),
					dataType : 'json',
					success:function(data) {
						if (data.status == 1) {
							msg.info(data.info);
						} else {
							msg.info(data.info);
						}
					}
				});
			},"是否保存？");
		}
	}
	//验证信息
	//验证空信息
	function checkEmpty(obj,msg){
		var check = false;
		var val = obj.val();
		if(val == ""){
			obj.err(msg);
		}else{
			check = true;
			//-obj.closeErr();
		}
		return check;
	}	
	
</script>
</body>
</html>
